home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-02-07 | 2.3 KB | 110 lines | [TEXT/MPS ] |
- (****************************)
- (* file: ADSPHangUp.p *)
- (* *)
- (* Disconnect an established*)
- (* connection and deallocate*)
- (* the data associated with*)
- (* the connection. *)
- (* *)
- (* In: params[1] Name of *)
- (* the entity to hangup on *)
- (* *)
- (* Out: error message, *)
- (* empty if none. *)
- (* *)
- (* ------------------------ *)
- (* By: Donald Koscheka *)
- (* Date: 2-Mar-89 *)
- (* All Rights Reserved *)
- (* *)
- (* ------------------------ *)
- (****************************)
-
- (*****************************
- Build Sequence
-
- pascal -o ADSPHangUp.p.o ADSPHangUp.p
- link -m ENTRYPOINT -rt XCMD=1304 -sn Main=ADSPHangUp∂
- ADSPHangUp.p.o∂
- "{libraries}"Interface.o ∂
- -o YourStackNameHere
-
- ******************************)
-
-
- {$R-}
- {$S ADSPHangUp}
- UNIT DummyUnit;
-
- (****************************)
- INTERFACE
- (****************************)
-
-
- Uses MemTypes, QuickDraw, OSIntf,
- ToolIntf, PackIntf, HyperXCmd,
- AppleTalk, ADSP, adspxcmd;
-
-
- Procedure EntryPoint( paramPtr : XCmdPtr );
-
-
- (****************************)
- IMPLEMENTATION
- (****************************)
- TYPE Str31 = String[31];
-
-
- PROCEDURE ADSPHangUp( paramPtr: XCmdPtr ); FORWARD;
-
- Procedure EntryPoint( paramPtr : XCmdPtr );
- Begin
- ADSPHangUp( paramPtr );
- End;
-
-
- Procedure ADSPHangUp( paramPtr : XCmdPtr );
- VAR
- adsp : ADSPPtr;
- error : OSErr;
- pb : DSPParamBlock;
- eAddr : AddrBlock;
- cb : CBPtr;
-
- {$I XCmdGlue.inc }
- {$I XCMDADSP.inc }
- (****************************)
- BEGIN
- error := noErr;
- IF ( paramPtr^.paramCount > 0 )
- AND ( paramPtr^.params[1] <> NIL ) THEN
- BEGIN
- adsp := ADSPPtr(RetrieveData( 'GLOBALDSPDATA' ));
- IF adsp <> NIL THEN
- BEGIN
- adsp^.checkPoint := RECEIVING;
- {*** (1) Get the entity's address ***}
- HLock( Handle(paramPtr^.params[1]) );
- eAddr := NBPGetAddress( paramPtr^.params[1]^ );
- cb := adsp^.ends;
-
- {*** match the entity to the list ***}
- IF LongInt(eAddr) <> 0 THEN
- WHILE cb <> NIL DO
- IF LongInt(cb^.adr ) = LongInt( eAddr ) THEN
- BEGIN
- error := DSPHangUp( cb );
- cb := NIL;
- END
- ELSE
- cb := cb^.next;
-
- HUnlock( Handle(paramPtr^.params[1]) );
- adsp^.checkPoint := CLOSE_OK;
- END
- END;
- paramPtr^.returnValue := PasToZero( NumToStr( LongInt(error) ) );
- END;
-
- end.
-